/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.subway.utilitarios;

import java.text.SimpleDateFormat;
import java.util.Date;
import javax.faces.application.FacesMessage;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import org.primefaces.event.DateSelectEvent;

/**
 *
 * @author Héctor <UFG>
 */
@ManagedBean(name = "calendarBean")
@SessionScoped
public class CalendarBean {

    private java.util.Date data;

    public Date getData() {
        return data;
    }

    public void setData(Date data) {
        this.data = data;
    }

    public void imprimirData() {
        System.out.println(data);
    }
    public void handleDateSelect(DateSelectEvent event) {  
        FacesContext facesContext = FacesContext.getCurrentInstance();  
        SimpleDateFormat format = new SimpleDateFormat("d/M/yyyy");  
        facesContext.addMessage(null, new FacesMessage(FacesMessage.SEVERITY_INFO, "Date Selected", format.format(event.getDate())));  
    }
}
